package admin

import database "hft/Database"

type Room struct {
	database.Base
	Name           string        `json:"name"`
	Grounding      bool          `json:"grounding"`
	LouPanName     string        `json:"louPanName"`
	RoomPayType    int           `json:"room_pay_type" gorm:"type:tinyint(1);default:0"`
	LouPanID       int           `json:"louPanId"`
	Area           int           `json:"area"`
	FirstPay       int           `json:"firstPay" gorm:"comment:几成首付"`
	IsAudit        int           `json:"isAudit" gorm:"type:tinyint(1);size:1"`
	BathRoom       int           `json:"bathRoom" gorm:"comment:卫"`
	Office         int           `json:"office" gorm:"comment:厅"`
	ReferencePrice int           `json:"referencePrice"`
	PropertyUse    int           `json:"propertyUse" gorm:"comment:物业用途:住宅，公寓，写字楼......"`
	Forward        int           `json:"forward" gorm:"type:tinyint(1);size:1"`
	Cover          string        `json:"cover" gorm:"type:text"`
	Status         int           `json:"status" gorm:"comment:销售状态"`
	SellStatus     SellStatus    `json:"sell_status,omitempty" gorm:"foreignKey:StatusCode;references:Status;constraint:OnDelete:SET NULL,OnUpdate:NO ACTION"`
	RoomId         int           `json:"roomId" gorm:"comment:户型id"`
	RoomType       RoomType      `json:"roomType,omitempty" gorm:"foreignKey:Code;references:RoomId;constraint:OnDelete:SET NULL,OnUpdate:NO ACTION"`
	RoomSwiper     []*RoomSwiper `json:"roomSwiper" gorm:"foreignKey:RoomID;references:ID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE"`
}

func (Room) TableName() string {
	return database.TableNameFormat("room")
}
